<!-- MENU -->
<%@page import="java.util.Iterator"%>

<script type="text/javascript">
$(document).ready(function() {
	$("#menuLink").find(".anchorMenu").each(function() {
		$(this).click(function() {
			//alert($(this).attr("href"));
			if($(this).attr("href") != "#"){
				$(this).trigger("mouseout");
				if($(this).attr("href").indexOf(".view") != -1)
				{
					$.wis.util.doView($(this).attr("href"));
				}
				else if($(this).attr("href").indexOf(".form") != -1)
				{
					$.wis.util.doViewForm($(this).attr("href"));
				}
				else
				{
					$.wis.util.doView1($(this).attr("href"));
				}
			}
			return false;
		});
	  });	    

});
	
</script>
<noscript>Your browser does not support script</noscript>

<%
java.util.List<com.ui.basic.command.CommandMenu> listmenu = (java.util.List<com.ui.basic.command.CommandMenu>)request.getAttribute("usermenu.listmenu");
if(listmenu!=null && listmenu.size()>0){
	out.println("<ul class=\"sf-menu\" id=\"menuLink\">");
	String oldCode = "";
	String oldName = "";
	for(com.ui.basic.command.CommandMenu menu : listmenu){
		if(menu.getCode().length()==2){
			if(oldCode.length()==2){
				out.println("</li>");
			}else if(oldCode.length()==4){
				out.println("</li></ul></li>");
			}else if(oldCode.length()==6){
				out.println("</li></ul></li></ul></li>");
			}
			if(oldCode.equals(""))
				out.println("<li class=\"current\">");
			else
				out.println("<li>");
			
			out.println("<a class=\"anchorMenu\" href=\""+(menu.getLink().equals("")?"#":request.getContextPath()+menu.getLink())+"\">"+menu.getName()+"</a>");
		}
		else if(menu.getCode().length()==4){
			if(oldCode.length()==2){
				out.println("<ul>");
			}else if(oldCode.length()==4){
				out.println("</li>");	
			}else if(oldCode.length()==6){
				out.println("</li></ul></li>");
			}	
			out.println("<li>");
			out.println("<a class=\"anchorMenu\" href=\""+(menu.getLink().equals("")?"#":request.getContextPath()+menu.getLink())+"\">"+menu.getName()+"</a>");
		}
		else if(menu.getCode().length()==6){
			if(oldCode.length()==4){
				out.println("<ul>");	
			}else if(oldCode.length()==6){
				out.println("</li>");
			}	
			out.println("<li>");
			out.println("<a class=\"anchorMenu\" href=\""+(menu.getLink().equals("")?"#":request.getContextPath()+menu.getLink())+"\">"+menu.getName()+"</a>");
		}
		oldCode = menu.getCode();
		oldName = menu.getName();
	}
	if(oldCode.length()==4)
		out.println("</ul></li>");
	if(oldCode.length()==6)
		out.println("</ul></li></ul></li>");
	out.println("</ul>");
}
%>

<!-- END of MENU -->